#ifndef _FNT_LISTMODEL_H_
#define _FNT_LISTMODEL_H_

#include <QAbstractItemModel>
#include "graph.h"

class ListModel : public QAbstractItemModel {
	Q_OBJECT;
	Graph graph;
	public:
	ListModel(QObject* s, Graph g);
	int columnCount(const QModelIndex& parent=QModelIndex()) const override;
	QVariant data(const QModelIndex& index, int role=Qt::DisplayRole) const override;
	Qt::ItemFlags flags(const QModelIndex& index) const override;
	bool hasChildren(const QModelIndex& parent=QModelIndex()) const override;
	QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override;
	QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const override;
	QModelIndex parent(const QModelIndex& index) const override;
	int rowCount(const QModelIndex& parent=QModelIndex()) const override;

	void beginRemoveRow(int i) { return beginRemoveRows(QModelIndex{}, i, i); }
	void endRemoveRow() { return endRemoveRows(); }
	void beginInsertRow(int i) { return beginInsertRows(QModelIndex{}, i, i); }
	void endInsertRow() { return endInsertRows(); }
	void emitDataChanged(int i, int c0, int c1) { Q_EMIT dataChanged(createIndex(i, c0), createIndex(i, c1)); }

	bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole) override;
};

#endif
